//
//  GatherHeadView.m
//  RONGAO
//
//  Created by wei wang on 2017/2/23.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "GatherHeadView.h"

@implementation GatherHeadView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init{
    
    if ([super init]) {
        
        [self masLayoutSubview];
    }
    
    return self;
}

- (void)masLayoutSubview{
    
    __weak UIView *superView = self;
    __weak typeof(self) weakself = self;
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.centerY.mas_equalTo(superView.mas_centerY).mas_offset(-18);
        
    }];
    [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakself.titleLabel);
        make.right.mas_equalTo(weakself.titleLabel.mas_left).mas_offset(-8);
        
    }];
    [self.rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakself.titleLabel);
        make.left.mas_equalTo(weakself.titleLabel.mas_right).mas_offset(8);
        
    }];
    
    [self.describeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(superView.mas_left).mas_offset(30);
        make.right.mas_equalTo(superView.mas_right).mas_offset(-30);
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.top.mas_equalTo(weakself.titleLabel.mas_bottom).mas_offset(4);
        make.bottom.mas_equalTo(superView.mas_bottom).mas_offset(-4);
    }];

}


- (UIImageView *)leftImageView{
    
    if (!_leftImageView) {
        
        _leftImageView = [[UIImageView alloc] init];
        _leftImageView.image = [UIImage imageNamed:@"line_49"];
        [self addSubview:_leftImageView];
    }
    return _leftImageView;
}

- (UIImageView *)rightImageView{
    
    if (!_rightImageView) {
        
        _rightImageView = [[UIImageView alloc] init];
        _rightImageView.image = [UIImage imageNamed:@"line"];
        [self addSubview:_rightImageView];
    }
    return _rightImageView;
}

- (UILabel *)titleLabel{
    
    if (!_titleLabel) {
        
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor colorWithHexString:@"#84807f"];
        _titleLabel.text = @"调节说明";
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}

- (UILabel *)describeLabel{
    
    if (!_describeLabel) {
        
        _describeLabel = [[UILabel alloc] init];
        _describeLabel.textColor = [UIColor colorWithHexString:@"#56504f"];
        _describeLabel.numberOfLines = 0;
        _describeLabel.adjustsFontSizeToFitWidth = YES;
        _describeLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_describeLabel];
    }
    return _describeLabel;
}
@end
